package Project4;

import Project4.lexer.*;
import Project4.node.*;
import Project4.parser.*;
import java.io.*;

public class Main{

   public static void main(String[] arguments){
      try{
            Lexer lexer = new Lexer(new PushbackReader
                  (new InputStreamReader(System.in), 1024));

            Parser parser = new Parser(lexer);

            Start ast = parser.parse();
            SymbolTable table = new SymbolTable();
			SymbolTableMethodSweep m = new SymbolTableMethodSweep(table);
			ast.apply(m);
            
            SymbolTableVariableSweep v = new SymbolTableVariableSweep(table);
            ast.apply(v);
            //System.out.println("It's valid!");

			ast.apply(new AssemblerTAC());
      }
      catch(Exception e){ System.out.println("***** COMPILER CRASH: " + e ); e.printStackTrace();}
   }
}
